//初始化地图
export function initMap() {
    // 创建三维地球场景
    const map = new mars3d.Map("map-container", {
        scene: {
            center: {
                lat: 30.054604,
                lng: 108.885436,
                alt: 17036414,
                heading: 0,
                pitch: -90,
            },
            showSun: true,
            showMoon: true,
            showSkyBox: true,
            showSkyAtmosphere: false, // 关闭球周边的白色轮廓 map.scene.skyAtmosphere = false
            fog: true,
            fxaa: true,
            globe: {
                showGroundAtmosphere: false, // 关闭大气（球表面白蒙蒙的效果）
                depthTestAgainstTerrain: false,
                baseColor: "#546a53",
            },
            cameraController: {
                zoomFactor: 3.0,
                minimumZoomDistance: 1,
                maximumZoomDistance: 50000000,
                enableRotate: true,
                enableZoom: true,
            },
        },
        control: {
            baseLayerPicker: false, // basemaps底图切换按钮
            homeButton: false, // 视角复位按钮
            sceneModePicker: false, // 二三维切换按钮
            navigationHelpButton: false, // 帮助按钮
            fullscreenButton: false, // 全屏按钮
            contextmenu: { hasDefault: false }, // 右键菜单
        },
        basemaps: [
            {
                name: "离线地图",
                icon: "img/basemaps/mapboxSatellite.png",
                // type: "tdt",
                type: "tms",
                layer: "img_d",
                "maximumLevel": 19,
                key: mars3d.Token.tiandituArr,
                show: true,
            },
        ],
    });

    window.mapViewer = map;
    return map;
}
